#include<bits/stdc++.h>
#define int long long
#define ls(x) ((x)*2)
#define rs(x) ((x)*2+1)
#define Debug(...) fprintf(stderr, __VA_ARGS__)
#define For(i,a,b) for(int i=a,i##end=b;i<=i##end;i++)
#define Rof(i,a,b) for(int i=a,i##end=b;i>=i##end;i--)
#define rep(i,  b) for(int i=1,i##end=b;i<=i##end;i++)
using namespace std;
const int N=2e5+5,Mod=998244353;
//char buf[(1<<21)+5],*p1,*p2;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
inline void chmx(int &x,int y){(x<y)&&(x=y);}
inline void chmn(int &x,int y){(x>y)&&(x=y);}
inline void Add(int &x,int y){(x=x+y+Mod)%=Mod;}
inline int read(){
	int f=0,x=0;
	char ch=getchar();
	while(!isdigit(ch)){f|=(ch=='-');ch=getchar();}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
	return f?-x:x;
}
int m;
int w[N];
int a,b;
inline int ksm(int a,int b){
	int res=1;
	while(b){
		if(b&1) res=res*a%Mod;
		a=a*a%Mod;b>>=1;
	}	
	return res;
}
signed main(){
	//~ cerr<<(&TTT-&SSS)/1024/1024<<"Mib";
	freopen("clown.in","r",stdin);
	freopen("clown.out","w",stdout);
	// ios::sync_with_stdio(false);
	// cin.tie(0); cout.tie(0);
	m=read();
	For(i,1,m) w[i]=read();
	a=read(),b=read();
	if(m==1){
		printf("%lld\n",(a*a%Mod*a%Mod*b%Mod*b%Mod*b%Mod-(a*(a-1)%Mod)*(b*(b-1)%Mod)%Mod*3-((a*(a-1)%Mod)*b%Mod+a*(b*(b-1)%Mod)%Mod%Mod)*3-a*b%Mod+Mod)%Mod);
		return 0;
	}
#ifdef LOCAL
    Debug("\nMy Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}
